package ar.com.digitalbricks.view.imprenta.cliente.action;

import java.util.HashSet;
import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import ar.com.digitalbricks.fwk.hbm.ActionTransactionSupportAbstract;
import ar.com.digitalbricks.imprenta.cliente.mgr.ClienteMgr;
import ar.com.digitalbricks.imprenta.persona.mgr.ContactoMgr;
import ar.com.digitalbricks.view.imprenta.general.ModuloAction;
import ar.com.digitalbricks.view.imprenta.helper.ClienteView;
import ar.com.digitalbricks.view.imprenta.helper.ContactoView;
import ar.com.digitalbricks.view.imprenta.helper.action.ViewHelperAction;

import com.opensymphony.xwork2.Action;

public class ClienteAction extends ActionTransactionSupportAbstract implements SessionAware, ModuloAction{
	private ClienteView clienteView;
	private Boolean showContactoDiv;

	private static ContactoMgr contactoMgr;
	private static ClienteMgr clienteMgr;
	private static ViewHelperAction viewHelper;
	
	protected Map<String, Object> session;

	@Override
	public String execute() throws Exception {
		session.put("contactos", new HashSet<ContactoView>());
		return Action.SUCCESS;
	}
	
	/***********************
	 * GETTERS AND SETTERS *
	 *******************//**/

	public ClienteMgr getClienteMgr() {
		return clienteMgr;
	}
	
	@SuppressWarnings("static-access")
	public void setClienteMgr(ClienteMgr clienteMgr) {
		this.clienteMgr = clienteMgr;
	}
	
	public ClienteView getClienteView() {
		if (this.clienteView == null){
			this.clienteView = new ClienteView();
		}
		return this.clienteView;
	}

	public void setClienteView(ClienteView clienteView) {
		this.clienteView = clienteView;
	}

	public String getShowContactoDiv() {
		if (this.showContactoDiv){
			return "display";
		}else{
			return "display:none";
		}
	}

	public void setShowContactoDiv(Boolean showContactoDiv) {
		this.showContactoDiv = showContactoDiv;
	}
	
	public ContactoMgr getContactoMgr() {
		return contactoMgr;
	}

	@SuppressWarnings("static-access")
	public void setContactoMgr(ContactoMgr contactoMgr) {
		this.contactoMgr = contactoMgr;
	}

	@Override
	public void setSession(Map<String, Object> map) {
		session = map;
	}
	
	public Map<String, Object> getSession() {
		return this.session;
	}

	public ViewHelperAction getViewHelper() {
		return viewHelper;
	}

	@SuppressWarnings("static-access")
	public void setViewHelper(ViewHelperAction viewHelper) {
		this.viewHelper = viewHelper;
	}

	@Override
	public String getRutaCss() {
		return "css/cliente/principal.css";
	}

	@Override
	public String getTitulo() {
		return "cliente.titulo";
	}
	
}